<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
    <title>Абреже</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="styles.css"/>
    <script>
        function stratchBorders() {
            var s = (document.getElementById('main_content').offsetHeight + 29).toString() + 'px';
            document.getElementById('left_border').style.height = s;
            document.getElementById('right_border').style.height = s;
        }
    </script>

   <?php session_start(); ?>




    <link rel="stylesheet" href="Scripts/themes/base/jquery.ui.all.css">
    <script src="Scripts/jquery-1.7.2.js"></script>
    <script src="Scripts/ui/jquery.ui.core.js"></script>
    <script src="Scripts/ui/jquery.ui.widget.js"></script>
    <script src="Scripts/ui/jquery.ui.accordion.js"></script>
    <link rel="stylesheet" href="Scripts/ui/demos.css">
    <script>
        $(function() {
            $( "#accordion" ).accordion();
        });
    </script>

</head>
<body onload="stratchBorders()" onresize="stratchBorders()">
<div id="wrapper">
    <div class="header" style="background-image:url(images/top.jpg)">
        <div style="text-align:right; width:43%; float:left">
            <a href="index.html"><img src="images/logo.png"/></a>
        </div>
        <div style="text-align:left; margin:0 50%; width:35%;">
            <div style="width:100%; height:20px">&nbsp;</div>
            <div class="head_menu_item"><a href="subjects.php">Рубрики</a></div>
            <div class="head_menu_item"><a href="reading_places.php">Лектории&nbsp;</a></div>
            <div class="head_menu_item"><a href="courses.php">Предметы</a></div>
        </div>
    </div>
    <div class="container">
        <div class="content">

            <div class="search_bar">

                <div class="container">
                    <div class="content">
                        <div class="header" style="height:auto">
                            <div class="container">
                                <div class="content">
                                    <div class="decorate_line_search_bar"
                                         style="background-image:url(images/search_bar_top.jpg)">&nbsp;</div>
                                    <!--text-->
                                </div>
                                <!--content-->
                                <div class="decorate_corner_left_search_bar"
                                     style="background-image:url(images/search_bar_corner_top_left.jpg)">&nbsp;</div>
                                <div class="decorate_corner_right_search_bar"
                                     style="background-image:url(images/search_bar_corner_top_right.jpg)">&nbsp;</div>
                            </div>
                            <!--container-->
                        </div>
                        <!--header-->

                        <div class="container">
                            <div class="content">
                                <div class="text" style="height:25px; text-overflow: ellipsis; overflow: hidden;">
                                    <div style="height:3px">&nbsp;</div>
                                    <div style="float:left;">
                                        <form action="">
                                            <input type="text" size="40" id="name" class="input"/>
                                            <input type="submit" value="Поиск" class="button"/>
                                        </form>
                                    </div>
                                    <div style="text-align:left; margin:0 65%; width:35%;">
                                        <div style="border-left:thick#000; width:auto; margin:0 0; text-align:right;">

                                            <div class="head_menu_item"><a href="signin.php"
                                                                           style="font-size:16px">
                                                <? if (isset($_SESSION['uid'])) {
                                                    echo $_SESSION['uid'];
                                                } else {
                                                    echo "Вход";
                                                } ?>
                                            </a></div>
                                            <div class="head_menu_item"><a href="registration.php" style="font-size:16px">Регистрация</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--text-->
                            </div>
                            <!--content-->
                            <div class="left" style="height:26px; background-image:url(images/search_bar_left.jpg)">
                                &nbsp;</div>
                            <div class="right" style="height:26px; background-image:url(images/search_bar_right.jpg)">
                                &nbsp;</div>
                            <div class="clear"></div>
                        </div>

                        <div class="footer" style="height:auto">
                            <div class="container">
                                <div class="content">
                                    <div class="decorate_line_search_bar"
                                         style="background-image:url(images/search_bar_bottom.jpg)">&nbsp;</div>
                                    <!--text-->
                                </div>
                                <!--content-->
                                <div class="decorate_corner_left_search_bar"
                                     style="background-image:url(images/search_bar_corner_bottom_left.jpg)">&nbsp;</div>
                                <div class="decorate_corner_right_search_bar"
                                     style="background-image:url(images/search_bar_corner_bottom_right.jpg)">&nbsp;</div
                                    >
                            </div>
                            <!--container-->
                        </div>
                        <!--footer-->
                    </div>
                    <!--content-->
                </div>
                <!--container-->

            </div>
            <!--search_bar-->

            <div class="text">
                <div class="header">
                    <div class="container">
                        <div class="content">
                            <div class="decorate_line" style="background-image:url(images/content_top.jpg)">&nbsp;</div>
                            <!--text-->
                        </div>
                        <!--content-->
                        <div class="decorate_corner_left" style="background-image:url(images/corner_up_left.jpg)">
                            &nbsp;</div>
                        <div class="decorate_corner_right" style="background-image:url(images/corner_up_right.jpg)">
                            &nbsp;</div>

                    </div>
                    <!--container-->
                </div>
                <!--header-->
                <div class="container">
                    <div class="content">
                        <div class="text" id="main_content">
                            <h1>Предметы</h1>

                            <div id="accordion">
                            <?
                            $link = mysql_connect('localhost', 'root', 'the1soop');
                            if (!$link) {
                                die('Ошибка соединения: ' . mysql_error());
                            }

                            $database = 'lectures';
                            if (!mysql_select_db($database)) {
                                echo "<h1>Can't select database</h1>";
                                // die("");
                            }

                            $query = "SELECT * FROM course where 1";
                            if ($_GET['reading_place_id'] && strcmp($_GET['reading_place_id'], "")) {
                                $id = $_GET['reading_place_id'];
                                $query .= " and reading_place_id=$id";
                            }
                            if ($_GET['subject_id'] && strcmp($_GET['subject_id'], "")) {
                                $id = $_GET['subject_id'];
                                $query .= " and subject_id=$id";
                            }
                            $result = mysql_query($query);

                            while($row = mysql_fetch_array($result)) { ?>
                                <h3><a href="#"><? echo $row['title'] ?></a></h3>
                                <div class="paragraph">
                                    <? echo $row['description'] ?>
                                <a class="no_underline" href="lectures.php?course_id=<? echo $row['course_id'] ?>">...see...</a>
                                </div>
                                <? }

                            mysql_close($link);
                            ?>
                                </div>
                        </div>
                        <!--text-->
                    </div>
                    <!--content-->
                    <div class="left" id="left_border" style="background-image:url(images/content_left.jpg)">
                        &nbsp;</div>
                    <div class="right" id="right_border" style="background-image:url(images/content_right.jpg)">
                        &nbsp;</div>
                    <div class="clear"></div>
                </div>
                <!--container-->
                <div class="footer" style="height:auto">
                    <div class="container">
                        <div class="content">
                            <div class="decorate_line" style="background-image:url(images/content_bottom.jpg)">
                                &nbsp;</div>
                            <!--text-->
                        </div>
                        <!--content-->
                        <div class="decorate_corner_left" style="background-image:url(images/corner_bottom_left.jpg)">
                            &nbsp;</div>
                        <div class="decorate_corner_right" style="background-image:url(images/corner_bottom_right.jpg)">
                            &nbsp;</div>

                    </div>
                    <!--container-->
                </div>
                <!--footer-->
            </div>
            <!--text-->
        </div>
        <!--content-->
        <div class="clear"></div>
    </div>
    <!--container-->
    <div class="footer" style="background-image:url(images/foot.jpg)"></div>
</div>
<!--warapper-->
<div style="text-indent: -9999px;">
</div>
</body>
</html>
